<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .clearfix:after{
            content: '.';
            clear: both;
            display: block;
            visibility: hidden;   /*把.隐藏*/
            height: 0;        /*把多出来的高度变为0*/
        }
        .c2{
            float: left;
        }
    </style>
</head>
<body>
    <div style="background-color: red;" class="clearfix">
        <div class="c2" style="background-color: green;height: 50px">11</div>
        <div class="c2">22</div>
<!--        <div style="clear: both"></div>-->
    </div>
</body>
</html>